package cn.com.utt.unms.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.com.utt.unms.pojo.Page;

@Mapper
public interface AgentPageMapper {
	@Select("select count(1) as num from agent_page where path=#{path} and userId=#{userId}")
	int agentPageIsExist(@Param("userId") Long userId, @Param("path") String path);
	@Select({"<script>",
	    "SELECT count(*) as total", 
	    "FROM agent_page",
	    "WHERE ", 
	    "path IN", 
	      "<foreach item='item' index='index' collection='pages'",
	        "open='(' separator=',' close=')'>",
	        "#{item.path}",
	      "</foreach>",
	      "and id IN",
	      "<foreach item='item' index='index' collection='pages'",
	        "open='(' separator=',' close=')'>",
	        "#{item.from_agent}",
	      "</foreach>",
	"</script>"})
	int agentPagesIsExist(@Param("pages") List<Page> pages);

}
